package com.rl.service.impl;

import com.rl.dao.UserDao;
import com.rl.domain.*;
import com.rl.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService
{

    @Resource
    private UserDao userDao;

    @Override
    public User selectUserByUid(int uid) {
        return userDao.selectUserByUid(uid);
    }

    @Override
    public User login(String name, String pwd) {
        return userDao.selectUserByNamePwd(name,pwd);
    }

    @Override
    public int selectUserIdByName(String uname) {
        return userDao.selectUserIdByName(uname);
    }

    @Override
    public User selectUserByName(String name) {
        return userDao.selectUserByName(name);
    }

    @Override
    public void insertUser(User user) {
        userDao.insertUser(user);
    }

    @Override
    public void updataUserByName(String uname, String pwd, String name) {
        userDao.updataUserByName(uname, pwd, name);
    }

    @Override
    public List<Book> selectBook() {
        return userDao.selectBook();
    }

    @Override
    public Book selectBookById(int bid) {
        return userDao.selectBookById(bid);
    }

    @Override
    public int selectBookIdByName(String bname) {
        return userDao.selectBookIdByName(bname);
    }

    @Override
    public List<Book> selectBooksByName(String name) {
        return userDao.selectBooksByName(name);
    }

    @Override
    public void updateBookNum(int bid,int num) {
        userDao.updateBookNum(bid,num);
    }

    @Override
    public void insertShoppingCart(ShoppingCart shoppingCart) {
        userDao.insertShoppingCart(shoppingCart);
    }

    @Override
    public List<Book> selectShoppingCarByUserName(String uname) {
        return userDao.selectShoppingCarByUserName(uname);
    }

    @Override
    public Book selectShoppingCartBookByBidUname(String uname, int bid) {
        return userDao.selectShoppingCartBookByBidUname(uname,bid);
    }

    @Override
    public void updataShoppingcartBookByBidUid(int bnum, int bid, int uid) {
        userDao.updataShoppingcartBookByBidUid(bnum, bid, uid);
    }

    @Override
    public void deleteShoppingcartBookByBidUid(int bid, int uid) {
        userDao.deleteShoppingcartBookByBidUid(bid, uid);
    }

    @Override
    public void insertShoppingHistory(ShoppingHistory shoppingHistory) {
        userDao.insertShoppingHistory(shoppingHistory);
    }

    @Override
    public List<Book> selectShoppingHistoryUserName(String name) {
        return userDao.selectShoppingHistoryUserName(name);
    }

    @Override
    public void deleteHistoryByUidBid(int bid, int uid) {
        userDao.deleteHistoryByUidBid(bid, uid);
    }

    @Override
    public List<Mail> selectEmailByName(String uname2) {
        return userDao.selectEmailByName(uname2);
    }

    @Override
    public void insertEmail(Mail mail) {
        userDao.insertEmail(mail);
    }

    @Override
    public void insertOrders(Orders orders) {
        userDao.insertOrders(orders);
    }

    @Override
    public List<Orders> selectOrdersByUid(int uid1) {
        return userDao.selectOrdersByUid(uid1);
    }

    @Override
    public Orders selectOrdersByOid(int oid) {
        return userDao.selectOrdersByOid(oid);
    }

    @Override
    public List<Orders> selectOrdersByUid1(int uid1) {
        return userDao.selectOrdersByUid1(uid1);
    }

    @Override
    public List<Orders> selectFaOrdersByUid(int uid1) {
        return userDao.selectFaOrdersByUid(uid1);
    }
    @Override
    public List<Orders> selectByOrdersByUid(int uid1) {
        return userDao.selectByOrdersByUid(uid1);
    }

    @Override
    public void updateOrdersByOid(int flag, int oid) {
        userDao.updateOrdersByOid(flag, oid);
    }

    @Override
    public void updateOrdersUid1ByOid(int uid1, int oid) {
        userDao.updateOrdersUid1ByOid(uid1, oid);
    }

    @Override
    public void updateOrdersNumByOid(int num, int oid) {
        userDao.updateOrdersNumByOid(num, oid);
    }

    @Override
    public void updateOrdersFlag2ByOid(int flag2, int oid) {
        userDao.updateOrdersFlag2ByOid(flag2, oid);
    }

}
